<div class="bjui-pageContent">
    <form action="{:U('Setting/site')}" class="pageForm" data-toggle="validate">
        <fieldset>
            <legend>
                <?php echo L('basic_configuration')?>
            </legend>
            <table width="100%" class="table_form">
                <tr>
                    <th width="80">
                        <?php echo L('site_name')?>：</th>
                    <td class="y-bg">
                        <input type="text" class="input-text" name="info[name]" id="name" size="30" value="<?php echo $Detail['name']?>" />
                    </td>
                </tr>
                <tr>
                    <th>
                        <?php echo L('site_dirname')?>：</th>
                    <td class="y-bg">
                        <?php if ($siteid == 1) { echo $Detail['dirname'];} else {?>
                        <input type="text" class="input-text" name="info[dirname]" id="dirname" size="30" value="<?php echo $Detail['dirname']?>" />
                        <?php }?>
                    </td>
                </tr>
                <tr>
                    <th>
                        <?php echo L('site_domain')?>：</th>
                    <td class="y-bg">
                        <input type="text" class="input-text" name="info[domain]" id="domain" size="30" value="<?php echo $Detail['domain']?>" />
                    </td>
                </tr>
            </table>
        </fieldset>
        <div class="bk10"></div>
        <fieldset>
            <legend>
                <?php echo L('seo_configuration')?>
            </legend>
            <table width="100%" class="table_form">
                <tr>
                    <th width="80">
                        <?php echo L('site_title')?>：</th>
                    <td class="y-bg">
                        <input type="text" class="input-text" name="info[site_title]" id="site_title" size="30" value="<?php echo $Detail['site_title']?>" />
                    </td>
                </tr>
                <tr>
                    <th>
                        <?php echo L('keyword_name')?>：</th>
                    <td class="y-bg">
                        <input type="text" class="input-text" name="info[keywords]" id="keywords" size="30" value="<?php echo $Detail['keywords']?>" />
                    </td>
                </tr>
                <tr>
                    <th>
                        <?php echo L('description')?>：</th>
                    <td class="y-bg">
                        <input type="text" class="input-text" name="info[description]" id="description" size="30" value="<?php echo $Detail['description']?>" />
                    </td>
                </tr>
            </table>
        </fieldset>
        <div class="bk10"></div>
        <fieldset>
            <legend><?php echo L('template_style_configuration')?></legend>
            <table width="100%"  class="table_form">
          <tr>
            <th width="80" valign="top"><?php echo L('style_name')?>：</th>
            <td class="y-bg"> <select name="template[]" size="3" id="template" multiple title="<?php echo L('ctrl_more_selected')?>" onchange="default_list()" style="display: none;">
            
                <?php 
                    $default_template_list =  array();


                    if(is_array($template_list)):
                    foreach ($template_list as $key=>$val):
                    $dirname[] = $val['dirname'];
                    $default_template_list[$val['dirname']] = $val['name'];
                ?>
                  <option value="<?php echo $val['dirname']?>" <?php if(in_array($val['dirname'], $dirname)){echo 'selected';}?>><?php echo $val['name']?></option>
                  <?php endforeach;endif;?>
                </select></td>
          </tr>
          <tr>
            <th width="80" valign="top"><?php echo L('default_style')?>：<input type="hidden" name="info[default_style]" id="default_style_input" value="<?php echo $Detail['default_style']?>"></th>
            <td class="y-bg"><span id="default_style">
            <?php 
                if(is_array($dirname) && !empty($dirname)) foreach ($dirname as $v) {
                    echo '<label><input type="radio" name="default_style_radio" value="'.$v.'" onclick="$(\'#default_style_input\').val(this.value);" '.($Detail['default_style']==$v ? 'checked' : '').'>'.$default_template_list[$v].'</label>';
                }
            ?>
            </span><span id="default_style_msg"></span></td>
          </tr>
        </table>
        <script type="text/javascript">
        function default_list() {
            var html = '';
            var old = $('#default_style_input').val();
            var checked = '';
            $('#template option:selected').each(function(i,n){
                if (old == $(n).val()) {
                    checked = 'checked';
                }
                 html += '<label><input type="radio" name="default_style_radio" value="'+$(n).val()+'" onclick="$(\'#default_style_input\').val(this.value);" '+checked+'> '+$(n).text()+'</label>';
            });
            if(!checked)  $('#default_style_input').val('0');
            $('#default_style').html(html);
        }
        </script>
        </fieldset>
        <div class="bk10"></div>
        <fieldset>
            <legend>
                <?php echo L('site_att_config')?>
            </legend>
            <table width="100%" class="table_form">
                <tr>
                    <th width="130" valign="top">
                        <?php echo L('site_att_upload_maxsize')?>
                    </th>
                    <td class="y-bg">
                        <input type="text" class="input-text" name="setting[upload_maxsize]" id="upload_maxsize" size="10" value="<?php echo $setting['upload_maxsize'] ? $setting['upload_maxsize'] : '2000' ?>" /> KB </td>
                </tr>
                <tr>
                    <th width="130" valign="top">
                        <?php echo L('site_att_allow_ext')?>
                    </th>
                    <td class="y-bg">
                        <input type="text" class="input-text" name="setting[upload_allowext]" id="upload_allowext" size="50" value="<?php echo $setting['upload_allowext']?>" />
                    </td>
                </tr>
                <th>
                    <?php echo L('site_att_watermark_enable')?>
                </th>
                <td class="y-bg">
                    <input class="radio_style" name="setting[watermark_enable]" value="1" <?php echo $setting[ 'watermark_enable']==1 ? 'checked="checked"' : ''?> type="radio">
                    <?php echo L('site_att_watermark_open')?>&nbsp;&nbsp;&nbsp;&nbsp;
                    <input class="radio_style" name="setting[watermark_enable]" value="0" <?php echo $setting[ 'watermark_enable']==0 ? 'checked="checked"' : ''?> type="radio">
                    <?php echo L('site_att_watermark_close')?>
                </td>
                </tr>
                <tr>
                    <th>
                        <?php echo L('site_att_watermark_condition')?>
                    </th>
                    <td class="y-bg">
                        <?php echo L('site_att_watermark_minwidth')?>
                        <input type="text" class="input-text" name="setting[watermark_minwidth]" id="watermark_minwidth" size="10" value="<?php echo $setting['watermark_minwidth'] ? $setting['watermark_minwidth'] : '300' ?>" /> X
                        <?php echo L('site_att_watermark_minheight')?>
                        <input type="text" class="input-text" name="setting[watermark_minheight]" id="watermark_minheight" size="10" value="<?php echo $setting['watermark_minheight'] ? $setting['watermark_minheight'] : '300' ?>" /> PX
                    </td>
                </tr>
                <tr>
                    <th width="130" valign="top">
                        <?php echo L('site_att_watermark_img')?>
                    </th>
                    <td class="y-bg">
                        <input type="text" name="setting[watermark_img]" id="watermark_img" size="30" value="<?php echo $setting['watermark_img'] ? $setting['watermark_img'] : 'mark.gif' ?>" />
                        <?php echo L('site_att_watermark_img_desc')?>
                    </td>
                </tr>
                <tr>
                    <th width="130" valign="top">
                        <?php echo L('site_att_watermark_pct')?>
                    </th>
                    <td class="y-bg">
                        <input type="text" class="input-text" name="setting[watermark_pct]" id="watermark_pct" size="10" value="<?php echo $setting['watermark_pct'] ? $setting['watermark_pct'] : '100' ?>" />
                        <?php echo L('site_att_watermark_pct_desc')?>
                    </td>
                </tr>
                <tr>
                    <th width="130" valign="top">
                        <?php echo L('site_att_watermark_quality')?>
                    </th>
                    <td class="y-bg">
                        <input type="text" class="input-text" name="setting[watermark_quality]" id="watermark_quality" size="10" value="<?php echo $setting['watermark_quality'] ? $setting['watermark_quality'] : '80' ?>" />
                        <?php echo L('site_att_watermark_quality_desc')?>
                    </td>
                </tr>
                <tr>
                    <th width="130" valign="top">
                        <?php echo L('site_att_watermark_pos')?>
                    </th>
                    <td>
                        <table width="100%" class="radio-label">
                            <tr>
                                <td rowspan="3">
                                    <input class="radio_style" name="setting[watermark_pos]" value="10" type="radio" <?php echo ($setting[ 'watermark_pos']==10) ? 'checked': ''?>>
                                    <?php echo L('site_att_watermark_pos_10')?>
                                </td>
                                <td>
                                    <input class="radio_style" name="setting[watermark_pos]" value="1" type="radio" <?php echo ($setting[ 'watermark_pos']==1) ? 'checked': ''?>>
                                    <?php echo L('site_att_watermark_pos_1')?>
                                </td>
                                <td>
                                    <input class="radio_style" name="setting[watermark_pos]" value="2" type="radio" <?php echo ($setting[ 'watermark_pos']==2) ? 'checked': '' ?>>
                                    <?php echo L('site_att_watermark_pos_2')?>
                                </td>
                                <td>
                                    <input class="radio_style" name="setting[watermark_pos]" value="3" type="radio" <?php echo ($setting[ 'watermark_pos']==3) ? 'checked': ''?>>
                                    <?php echo L('site_att_watermark_pos_3')?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input class="radio_style" name="setting[watermark_pos]" value="4" type="radio" <?php echo ($setting[ 'watermark_pos']==4) ? 'checked': ''?>>
                                    <?php echo L('site_att_watermark_pos_4')?>
                                </td>
                                <td>
                                    <input class="radio_style" name="setting[watermark_pos]" value="5" type="radio" <?php echo ($setting[ 'watermark_pos']==5) ? 'checked': ''?>>
                                    <?php echo L('site_att_watermark_pos_5')?>
                                </td>
                                <td>
                                    <input class="radio_style" name="setting[watermark_pos]" value="6" type="radio" <?php echo ($setting[ 'watermark_pos']==6) ? 'checked': ''?>>
                                    <?php echo L('site_att_watermark_pos_6')?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input class="radio_style" name="setting[watermark_pos]" value="7" type="radio" <?php echo ($setting[ 'watermark_pos']==7) ? 'checked': ''?>>
                                    <?php echo L('site_att_watermark_pos_7')?>
                                </td>
                                <td>
                                    <input class="radio_style" name="setting[watermark_pos]" value="8" type="radio" <?php echo ($setting[ 'watermark_pos']==8) ? 'checked': ''?>>
                                    <?php echo L('site_att_watermark_pos_8')?>
                                </td>
                                <td>
                                    <input class="radio_style" name="setting[watermark_pos]" value="9" type="radio" <?php echo ($setting[ 'watermark_pos']==9) ? 'checked': ''?>>
                                    <?php echo L('site_att_watermark_pos_9')?>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </fieldset>
    </form>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li>
            <button type="button" class="btn-close">关闭</button>
        </li>
        <li>
            <button type="submit" class="btn-default">保存</button>
        </li>
    </ul>
</div>
